package com.oplink.webems.modules.alarm.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * Trap Parameter Entity 
 * @author yizhang
 */
@Entity
@Table(name = "trap_param")
@DynamicInsert @DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class TrapParam {
	
	//ID
	private Long id;
	
	//Parameter OID
	private String paramoid;
	
	private String param;
	
	private String description;
	
	private TrapOid trapoid;
	
	private String fieldtype;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)		
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getParamoid() {
		return paramoid;
	}

	public void setParamoid(String paramoid) {
		this.paramoid = paramoid;
	}

	public String getParam() {
		return param;
	}

	public void setParam(String param) {
		this.param = param;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="trapoid")
	@NotFound(action = NotFoundAction.IGNORE)	
	@JsonIgnore	
	public TrapOid getTrapoid() {
		return trapoid;
	}

	public void setTrapoid(TrapOid trapoid) {
		this.trapoid = trapoid;
	}

	public String getFieldtype() {
		return fieldtype;
	}

	public void setFieldtype(String fieldtype) {
		this.fieldtype = fieldtype;
	}
}
